package com.db;

public class DateType extends DBType{
   
	
	public static String getDefaultComment(String name) {
		return "java.sql.Date "+name+ "= null";
	}
	
	public static String getComment(String name, String value) {
		if(value==null || value.trim()=="") {
			value = "null";
			return "java.sql.Date "+name+ "= null";
		}
		if(value.equalsIgnoreCase("SYSDATE")) {
			value = "new Date()";
		}
		return "java.sql.Date "+name+ "= "+ "new java.sql.Date("+value+".getTime())";
	}
	
	
	
	public static String getSetComment(String name, String value) {
		if(value==null || value.trim()=="") {		
			return name+ "= null";
		}
		if(value.trim().equalsIgnoreCase("SYSDATE")) {
			value = "new Date()";
		}
		return name+ "="+ "new java.sql.Date("+value+".getTime())";
	}
	
	
	public static String getSetFieldValueComment(String name, String value) {
		if(value==null || value.trim()=="") {		
			return name+ "= null";
		}
		if(value.equalsIgnoreCase("SYSDATE")) {
			value = "new Date()";
		}
		return name+ "=" + "new java.sql.Date("+value+".getTime())";
	}
	
	
	
	
}
